// 联合类型 |  
function swapBool(v:number | boolean):boolean{
    return !!v
}
console.log(swapBool(0))
console.log(swapBool(false))

interface Person{
    name:string,
    age:number
}
interface Man{
    sex:string
}
// 交叉类型 & 
let man:Person & Man = {
    name:'wyx',
    age:18,
    sex:'xy'
}

function fn(num:number |string):void{
    // 类型断言(num as string)
    // console.log((num as string).length)
    console.log((<string>num).length)

}
// 输出undefined，只能在编译时欺骗js引擎，运行时出错
console.log(fn('123'))


